load("@rules_cc//cc:defs.bzl", "cc_test")

_TESTS = {
    "cmdline_test": [],
    "exception_test": [],
    "exception_txt_test": [],
    "optional_test": [],
    "options_description_test": [],
    # Fails without logs "parsers_test": [],
    "positional_options_test": [],
    # Fails without logs "required_test": [],
    "split_test": [],
    # Fails because it uses a deprecated header "test_convert": ["@boost.timer"],
    "unicode_test": [],
    "unrecognized_test": [],
    "variable_map_test": [],
    "winmain": [],
}

[cc_test(
    name = test,
    srcs = ["{}.cpp".format(test)] + glob(["*.hpp"]),
    defines = select({
        "//conditions:default": [],
        "@platforms//os:macos": [],
        "@platforms//os:windows": ["WIN32_LEAN_AND_MEAN=1"],
    }),
    linkstatic = True,
    deps = [
        "@boost.program_options",
        "@boost.test",
        "@boost.test//:unit_test_main",
    ] + _TESTS[test],
) for test in _TESTS]
